package com.zs.controller;

import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.system.common.pojo.BisShopUser;
import com.zs.service.BisBusOrderService;

@Controller
@RequestMapping("order")
public class BisBusOrderController {
	  @Autowired
	  private BisBusOrderService bisBusOrderService;
	  
	  @RequestMapping("queryOrder")
	  public String queryByOrder(Model model,HttpSession session){
		  String shopId=(String)session.getAttribute("shopId");
          if(shopId!=null&&!shopId.equals("")){
    		  List<Map<String, Object>> OrderList=bisBusOrderService.queryByOrder(shopId);
    		  for (Map<String, Object> map : OrderList) {
    			  model.addAttribute("busmoney", map.get("busmoney"));
	  			  model.addAttribute("busnum", map.get("busnum"));
  		      }
          }else{
        	  BisShopUser shopUser=(BisShopUser)session.getAttribute("shopUser");
    		  List<Map<String, Object>> OrderList=bisBusOrderService.queryByOrder(shopUser.getShopId());
    		  for (Map<String, Object> map : OrderList) {
    			  model.addAttribute("busmoney", map.get("busmoney"));
	  			  model.addAttribute("busnum", map.get("busnum"));			   
  		      }
          }
		  return "BisShopUser/ShowBisBusOrder";
	  }
}
